<template>
  <div class="time-box" @click="$emit('click')">
    <div class="num-show">
      <div class="num">
        {{ item.t1 }}
      </div>
      <div class="serial">
        {{ item.t2 }}
        <img src="./1.jpg" v-if="item.t5 == '1'" />
        <img src="./2.jpg" v-if="item.t5 == '2'" />
        <img src="./3.jpg" v-if="item.t5 == '3'" />
        <img src="./4.jpg" v-if="item.t5 == '4'" />
        <img src="./5.jpg" v-if="item.t5 == '5'" />
      </div>
    </div>
    <div class="time-show">
      <div class="show-run">
        <div class="time-text">
          <i class="el-icon-watch" style="margin-right: 5px" />运行时间
        </div>
        <div class="time">{{ item.t3 }}</div>
      </div>
      <el-divider direction="vertical" class="time-divider"></el-divider>
      <div class="show-remain">
        <div class="time-text">
          <i class="el-icon-alarm-clock" style="margin-right: 5px" />剩余时间
        </div>
        <div class="time">{{ item.t4 }}</div>
      </div>
    </div>
    <div class="time-progress">
      <el-progress
        :text-inside="true"
        :stroke-width="16"
        :percentage="item.percent"
        :status="formatProgress(item.percent)"
      ></el-progress>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      default: () => {},
    },
  },
  computed: {
    formatProgress() {
      return function (data) {
        return data > 90 ? "exception" : "success";
      };
    },
  },
  methods: {},
};
</script>

<style lang='scss' scoped>
.time-box {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
  border-radius: 2px;
  .time-progress {
    padding: 0 10px;
    padding-bottom: 8px;
  }
  .num-show {
    display: flex;
    height: 32px;
    .num {
      font-size: 16px;
      display: flex;
      background: #e4e4e4;
      font-family: Microsoft YaHei;
      line-height: 32px;
      color: #333333;
      width: 48px;
      justify-content: center;
    }
    .serial {
      font-size: 16px;
      display: flex;
      background: #fafafa;
      width: 100%;
      line-height: 32px;
      padding-left: 10px;
      // justify-content: center;
      img {
        width: 35%;
        margin: 3px 0 3px 5%;
      }
    }
  }
}
.time-show {
  font-weight: 400;
  line-height: 22px;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  display: flex;
  position: relative;
  .time-divider {
    height: 16px;
    width: 1px;
    background-color: #999999;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
  }
}
.time-text {
  font-size: 14px;
  color: #999999;
}
.time-show .time {
  font-size: 14px;
  color: #333333;
  margin-left: 12px;
}
.t_div1 {
  width: 5px;
  background-color: #24aa76;
  margin: 4px 0 4px 0;
}
</style>